package com.foreknow.oop;

/**
 * @author shkstart
 * @create 2021-07-22 16:34
 */

/**
 * private 表示私有的：只能在当前的类中访问
 * this:表示对象自身
 * JavaBean 就是一个普通的Java类，只包含get/set方法
 * 规范  类名与数据库的表名相同  属性名与表中的列名相同
 *
 */
public class Student {
    private String id;
    private String name;
    private int age;
    private String school;

    public Student() {
        super();
    }
    //获取属性值
    public String getId() {
        return id;
    }
    //给对象的属性赋值
    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getSchool() {
        return school;
    }

    public void setSchool(String school) {
        this.school = school;
    }

    public Student(String id, String name, int age, String school) {
        this.id = id;
        this.name = name;
        this.age = age;
        this.school = school;
    }

    public void eat(){
        System.out.println("学生要吃有营养的");
    }
    public void sleep(){
        System.out.println("早睡早起");
    }

    @Override
    public String toString() {
        return "Student{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", age=" + age +
                ", school='" + school + '\'' +
                '}';
    }


    public static void main(String[] args) {
        Student s=new Student();
        s.setName("Mrwang");
        s.setAge(18);
        s.setId("001");
        s.setSchool("bengji");
        System.out.println(s.toString());
    }
}
